Skip to content

refactor(pathfinder): unify header search architecture with library loading pattern#1738

Merged
cpcloud merged 1 commit intoNVIDIA:mainfrom
cpcloud:header-finding-refactor
Mar 11, 2026
Merged

refactor(pathfinder): unify header search architecture with library loading pattern#1738
cpcloud merged 1 commit intoNVIDIA:mainfrom
cpcloud:header-finding-refactor

Conversation

@cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Mar 7, 2026

Summary

  • Introduces a HeaderDescriptorSpec descriptor catalog for headers, mirroring the DescriptorSpec catalog pattern already used for dynamic library loading. All per-header metadata (basename, site-packages dirs, anchor layout, platform availability, system install dirs) is now authored once in a single catalog tuple, rather than spread across several manually maintained dicts.
  • supported_nvidia_headers.py now derives its legacy table exports from the catalog (same approach as supported_nvidia_libs.py), and find_nvidia_headers.py operates on descriptors directly — eliminating the name-based if libname == "nvvm" / if libname == "cccl" branching in favor of descriptor fields (anchor_include_rel_dirs, include_subdirs, include_subdirs_windows).
  • Public API (LocatedHeaderDir, find_nvidia_header_directory, locate_nvidia_header_directory, SUPPORTED_HEADERS_CTK) is unchanged.

Intentional behavioral note: The old code raised RuntimeError when calling locate_nvidia_header_directory with a header name not available on the current platform (e.g., "cufile" on Windows). The new code returns None instead, since the descriptor exists but the search simply finds nothing. This is more consistent with how callers handle "not found" and mirrors the library side's distinction between unknown vs. unavailable.

Test plan

  • All existing header tests pass (test_find_nvidia_headers.py)
  • All descriptor catalog tests pass (test_descriptor_catalog.py)
  • Full test suite passes (882 passed, 1 skipped)
  • Verified all derived legacy tables produce identical values to the old hardcoded dicts

Made with Cursor

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Mar 7, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cpcloud cpcloud force-pushed the header-finding-refactor branch from a65ef88 to 3c96fcc Compare March 7, 2026 00:40
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Mar 7, 2026

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@cpcloud
Copy link
Contributor Author

cpcloud commented Mar 7, 2026

/ok to test

@cpcloud cpcloud force-pushed the header-finding-refactor branch from 3c96fcc to 550bd47 Compare March 7, 2026 01:33
@cpcloud
Copy link
Contributor Author

cpcloud commented Mar 7, 2026

/ok to test

@cpcloud cpcloud force-pushed the header-finding-refactor branch from 550bd47 to 643fec9 Compare March 7, 2026 01:56
@github-actions

This comment has been minimized.

@cpcloud cpcloud force-pushed the header-finding-refactor branch from 643fec9 to b26cf85 Compare March 7, 2026 02:04
@cpcloud
Copy link
Contributor Author

cpcloud commented Mar 7, 2026

/ok to test

Mirror the dynamic-library descriptor-catalog pattern for headers.
All per-header metadata (basename, site-packages dirs, anchor layout,
platform availability, system install dirs) is now authored once in
HeaderDescriptorSpec entries in header_descriptor_catalog.py.

- header_descriptor_catalog.py: authored catalog with HeaderDescriptorSpec;
  each entry declares its own search capabilities via fields like
  use_ctk_root_canary, conda_targets_layout, and system_install_dirs
- header_descriptor.py: name-keyed HEADER_DESCRIPTORS registry and
  platform-dispatch helpers (platform_include_subdirs, resolve_conda_anchor)
- supported_nvidia_headers.py: derives legacy tables from the catalog
- find_nvidia_headers.py: composable HeaderFindStep functions with a single
  unified FIND_STEPS sequence and run_find_steps cascade runner; each step
  self-gates based on descriptor fields; search code is platform-agnostic

Public API (LocatedHeaderDir, find_nvidia_header_directory,
locate_nvidia_header_directory, SUPPORTED_HEADERS_CTK) is unchanged.

Made-with: Cursor
@cpcloud cpcloud force-pushed the header-finding-refactor branch from b26cf85 to 9ff02da Compare March 7, 2026 14:17
@cpcloud
Copy link
Contributor Author

cpcloud commented Mar 7, 2026

/ok to test

Copy link
Contributor

@Andy-Jost Andy-Jost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any issues.

@cpcloud cpcloud merged commit 9b74eaf into NVIDIA:main Mar 11, 2026
86 checks passed
@cpcloud cpcloud deleted the header-finding-refactor branch March 11, 2026 15:37
@github-actions
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants